﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace YunNanHealthProject_Register.Entity
{
    /// <summary>
    /// 写代码必须要有一种行云流水的优雅
    /// </summary>
    class RuleRegist
    {
        /// <summary>
        /// 规则类型
        /// </summary>
        private int ruleType;
        /// <summary>
        /// 规则周期
        /// </summary>
        private int ruleCycle;
        /// <summary>
        /// 规则运算符
        /// </summary>
        private int ruleAlgorithm;
        /// <summary>
        /// 规则值
        /// </summary>
        private String ruleValue;
        /// <summary>
        /// 规则类型字典
        /// </summary>
        private static Dictionary<int, String> ruleTypeDic = new Dictionary<int, string>();
        /// <summary>
        /// 规则周期字典
        /// </summary>
        private static Dictionary<int, String> ruleCycleDic = new Dictionary<int, string>();
        /// <summary>
        /// 规则运算符字典
        /// </summary>
        private static Dictionary<int, String> ruleAlgorithmDic = new Dictionary<int, string>();

        /// <summary>
        /// 规则类型
        /// </summary>
        private String ruleTypeStr;
        /// <summary>
        /// 规则周期
        /// </summary>
        private String ruleCycleStr;
        /// <summary>
        /// 规则运算符
        /// </summary>
        private String ruleAlgorithmStr;

        public int RuleType { get => ruleType; set => ruleType = value; }
        public int RuleCycle { get => ruleCycle; set => ruleCycle = value; }
        public int RuleAlgorithm { get => ruleAlgorithm; set => ruleAlgorithm = value; }
        public string RuleValue { get => ruleValue; set => ruleValue = value; }
        public static Dictionary<int, string> RuleTypeDic { get => ruleTypeDic;}
        public static Dictionary<int, string> RuleCycleDic { get => ruleCycleDic;}
        public static Dictionary<int, string> RuleAlgorithmDic { get => ruleAlgorithmDic;}
        public string RuleTypeStr { get => ruleTypeStr; set => ruleTypeStr = value; }
        public string RuleCycleStr { get => ruleCycleStr; set => ruleCycleStr = value; }
        public string RuleAlgorithmStr { get => ruleAlgorithmStr; set => ruleAlgorithmStr = value; }


        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="ruleType"></param>
        /// <param name="ruleCycle"></param>
        /// <param name="ruleAlgorithm"></param>
        /// <param name="ruleValue"></param>
        public RuleRegist(int ruleType, int ruleCycle, int ruleAlgorithm, String ruleValue)
        {
            InitClass();
            RuleType = ruleType;
            RuleCycle = ruleCycle;
            RuleAlgorithm = ruleAlgorithm;
            RuleValue = ruleValue;

            RuleTypeStr = RuleTypeDic[ruleType];
            RuleCycleStr = RuleCycleDic[ruleCycle];
            RuleAlgorithmStr = RuleAlgorithmDic[ruleAlgorithm];
        }

        public static void InitClass()
        {
            RuleTypeDic.Clear();
            RuleCycleDic.Clear();
            RuleAlgorithmDic.Clear();
            //规则类型字典
            RuleTypeDic.Add(10, "预约次数");
            RuleTypeDic.Add(20, "爽约次数");
            RuleTypeDic.Add(30, "退号次数");
            RuleTypeDic.Add(40, "黑名单冻结时间");
            RuleTypeDic.Add(51, "放号(开始)时间");
            RuleTypeDic.Add(52, "放号(截止)时间");
            RuleTypeDic.Add(53, "放号(开始)区间");
            RuleTypeDic.Add(54, "放号(截止)区间");
            RuleTypeDic.Add(55, "1+1+1 放号(开始)区间");
            RuleTypeDic.Add(56, "1+1+1 放号(结束)区间");
            RuleTypeDic.Add(61, "退号时间");
            RuleTypeDic.Add(62, "退号区间");
            RuleTypeDic.Add(63, "放号天数");
            //规则周期字典
            RuleCycleDic.Add(1, "天");
            RuleCycleDic.Add(2, "月");
            RuleCycleDic.Add(9, "其它");
            //规则运算符字典
            RuleAlgorithmDic.Add(1, "小于");
            RuleAlgorithmDic.Add(2, "大于");
            RuleAlgorithmDic.Add(3, "等于");
            RuleAlgorithmDic.Add(4, "小于等于");
            RuleAlgorithmDic.Add(5, "大于等于");
        }
    }
}
